package com.cn.ZhiKeDianShang.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

import com.cn.ZhiKeDianShang.R;
import com.cn.ZhiKeDianShang.base.RecycleAndListBaseAdapter.RecycleBaseAdapter.RecycleBaseViewHolder;
import com.cn.ZhiKeDianShang.base.RecycleAndListBaseAdapter.RecycleBaseAdapter.RecycleListBaseAdapter;
import com.cn.ZhiKeDianShang.model.response.NoticLiist;

import java.util.List;


public class NoticAdapter extends RecycleListBaseAdapter<NoticLiist.AnnouncementBean> {

    private Context mContext;
    private Animation mLikeAnim;
    private onItemClick onItemClick;

    public NoticAdapter(Context context, int layoutId, List<NoticLiist.AnnouncementBean> datas, onItemClick onItemClick) {
        super(context, layoutId, datas);
        this.mContext = context;
        mLikeAnim = AnimationUtils.loadAnimation(context, R.anim.anim_like);
        this.onItemClick = onItemClick;
    }

    @Override
    public void convert(RecycleBaseViewHolder helper, NoticLiist.AnnouncementBean tiktokBean, int position) {

        helper.setText(R.id.tv_title, tiktokBean.getTitle() + "");
        helper.setText(R.id.tv_time, tiktokBean.getCreatetime() + "");
//
        helper.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onItemClick.onItemClick(position);
            }
        });
    }

    @Override
    public void convert(RecycleBaseViewHolder helper, NoticLiist.AnnouncementBean tiktokBean, List<Object> payloads, int position) {
        Log.d("Debug", "到达局部刷新这里-------------------->>>>payloads" + payloads);
    }



    public interface onItemClick {
        void onItemClick(int position);
    }
}
